package com.lighthouse.common;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.lighthouse.repo.domain.KnowledgeRepoBaseInfo;
import com.ruoyi.common.core.domain.TreeSelect;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysMenu;

import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;

/**
 * Treeselect树结构实体类
 * 
 * @author ruoyi
 */
public class TreeSelectKnowledge extends TreeSelect implements Serializable
{
    private static final long serialVersionUID = 1L;

    /** 节点ID */
    private String repoId;

    /** 节点名称 */
    private String repoName;

    /** 子节点 */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<TreeSelectKnowledge> repoChildren;

    public TreeSelectKnowledge(KnowledgeRepoBaseInfo knowledgeRepoBaseInfo)
    {
        this.repoId = knowledgeRepoBaseInfo.getRepoId();
        this.repoName = knowledgeRepoBaseInfo.getRepoName();
        this.repoChildren = knowledgeRepoBaseInfo.getChildren().stream().map(TreeSelectKnowledge::new).collect(Collectors.toList());
    }

    public String getRepoId() {
        return repoId;
    }

    public void setRepoId(String repoId) {
        this.repoId = repoId;
    }

    public String getRepoName() {
        return repoName;
    }

    public void setRepoName(String repoName) {
        this.repoName = repoName;
    }

    public List<TreeSelectKnowledge> getRepoChildren() {
        return repoChildren;
    }

    public void setRepoChildren(List<TreeSelectKnowledge> repoChildren) {
        this.repoChildren = repoChildren;
    }
}
